<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>题库</title>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"  href="<c:url value="js/jquery-easyui-1.5.4.2/themes/ui-cupertino/easyui.css"/>"/>
<link  rel="stylesheet" type="text/css" href="<c:url value="js/jquery-easyui-1.5.4.2/themes/icon.css"/>"/>
<body>
<script type="text/javascript">
	
	$(function(){
		$('.examAssistData_tianjia').linkbutton({
			onClick:function(){
				$("#examAssistData_tianjia1").dialog("open");
			}
		})
		
		$("#examAssistData_clear").linkbutton({onClick:function(){
			//找到选中的行
			var row = $("#hhy_examAssistData_findAll_datagrid").datagrid("getSelected");
			if(!row){
				$.messager.alert('提示', '没有选中要删除的行！');
				return;
			}
			
			$.messager.confirm('确认', '真的要删除吗？', function(v){
				$("<form method = 'post'>").appendTo(document.body).form({
					url:'examAssistData_delete',
					onSubmit:function(params){
						params["codingId"] =row.codingId;
					},success:function(v){
						v = eval("(" + v + ")");
						if(v.success){
							
							$.messager.alert('恭喜', '删除成功');
							$('#hhy_examAssistData_findAll_datagrid').datagrid('reload');
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					}
				}).submit();

			});
		}});
		

		
	});		
</script>
<style type="text/css">
	.line{
		margin:5px 20px;
	}
</style>
	<table id="hhy_examAssistData_findAll_datagrid" class="easyui-datagrid" style="text-align:center;width:100%;" data-options="
		method:'post',
		fitColumns:true,
		url:'to_examAssistData_findAll',
		fit:true,
		nowrap:false,
		autoRowHeight:true,
		rownumbers:true,
		singleSelect:true,
		pagination:true,
		pageList:[5,10,15,20,25],
		pageSize:5,
		striped:true,
		toolbar:'#examAssistData'
	">
		<thead>
			<tr>
				<th data-options="field:'codingId',align:'center',width:'20'">编号</th>
				<th data-options="field:'codingName',align:'center',width:'20'">名称</th>
				<th data-options="field:'skillName',align:'center',width:'20'">技能</th>
				<th data-options="field:'codingRemark',align:'center',width:'20'">备注</th>
				<th data-options="field:'codingBlockup',align:'center',width:'20'">停用</th>
				<th data-options="field:'codingPerson',align:'center',width:'20'">创建者</th>
				<th data-options="field:'codingUpdate',align:'center',width:'50',
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">创建日期</th>
				<th data-options="field:'codingFinaylly',align:'center',width:'50',
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">更新日期</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
	<div id="examAssistData">
		<a href="#" class="easyui-linkbutton examAssistData_tianjia" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a>
		<a href="#" class="easyui-linkbutton" id="examAssistData_clear" data-options="iconCls:'icon-clear',plain:true,text:'删除'"></a>
		搜索文本  <input id="examAssistData_bir" class="easyui-searchbox" data-options="width:100">
		<a id="examAssistData_btn" class="easyui-linkbutton" data-options="width:60,plain:false,text:'搜索'"></a> 
	</div>
	<div class="easyui-dialog" id="examAssistData_tianjia1" data-options="width:350,height:300,title:'题库',
				modal:true,
				closed:true,
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
						$('#hhy_examAssistData_insert').form({    
							url:'to_examAssistData_insert',
								onSubmit: function(s){
								   alert($('#codingName').textbox('getText'));
								   alert($('#skillName').val());
								   alert($('#codingRemark').textbox('getText'));
								   alert($('#codingBlockup').val());
								   
								},    
								success:function(v){
									v = eval('('+v+')');
									if(v.success){
										$('#examAssistData_tianjia1').dialog('close');
										$('#hhy_examAssistData_insert').form('reset');
										$('#hhy_examAssistData_findAll_datagrid').datagrid('reload');
									}else{
										$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
									}
							}
						}).submit();
					}	
					},{
						text:'取消',
						iconCls:'icon-clear',
						handler:function(){
							$('#examAssistData_tianjia1').dialog('close');		
						}
					}]">
			<form action="" method="post" id="hhy_examAssistData_insert">
					<div class="line">
						<input class="easyui-textbox" id="codingName" name="codingName" data-options="label:'*名称',width:280,height:25,labelWidth:80"/>
					</div>
					<div class="line">
						<select name="skillName" id="skillName" class="easyui-combobox" data-options="label:'技能',width:280,height:25,panelHeight:'auto',labelWidth:80,editable:false">
							<c:forEach items="${skillName}" var="skill">
								<option >${skill.skillName}</option>
							</c:forEach>
						</select>
					</div>
					<div class="line">
						<input class="easyui-textbox" name="codingRemark" id="codingRemark" data-options="label:'备注',width:280,height:50,labelWidth:80"/>
					</div>
					<div class="line">
							<select id="codingBlockup" name="codingBlockup" class="easyui-combobox"  data-options="label:'停用',width:280,height:25,panelHeight:'auto',labelWidth:80,editable:false">
								<option value="0">是</option>
								<option value="1">否</option>
							</select>
					</div>
			</form>
			</div>
</body>
</html>